package be.kuleuven.peno3.mobiletoledo.view.course;

import java.util.Calendar;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import be.kuleuven.peno3.mobiletoledo.R;
import be.kuleuven.peno3.mobiletoledo.Data.Client.AnnouncementClient;
import be.kuleuven.peno3.mobiletoledo.model.Announcement;

public class ShowAnnouncement extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.showmessage);
		
		TextView title = (TextView) findViewById(R.id.title);
		TextView author = (TextView) findViewById(R.id.author);
		TextView date = (TextView) findViewById(R.id.date);
		TextView text = (TextView) findViewById(R.id.text);
		
		int announcementId = this.getIntent().getExtras().getInt("announcementId");
		
		Announcement announcement=AnnouncementClient.getAnnouncement(announcementId);
		
		Calendar cal = announcement.getPostDate();
		title.setText(announcement.getTitle());
		author.setText(announcement.getAuthor());
		date.setText("Op "+cal.get(Calendar.DAY_OF_MONTH)+"/"+(cal.get(Calendar.MONTH)+1)+"/"+cal.get(Calendar.YEAR)+" om "+cal.get(Calendar.HOUR_OF_DAY)+"u"+cal.get(Calendar.MINUTE));
		text.setText(announcement.getContent());

	}
}